SAC

Section: Maintenance Commands (8)
Updated:
Index Return to Main Contents
 

NAME

sac - system accounting.  

SYNOPSIS

sac [-dpahcotfFm] [-w wtmp|-] [-b H[:M[:S]]] [-s start] [-e end] [[-u] user-list] [-x [user-list]] [-T [tty-list]] [-H [host-list]]
 

DESCRIPTION

Sac is a system administration utility, based on the original BSD ac program, to read the wtmp log and produce more human readable system usage information than provided by last. Several features not found in the BSD version of this program have been added.

Sac like ac produces three different types of output: Total usage in number of login hours since wtmp was created (default), login usage per day (-d option), total usage per user (-p option). The output of these three are modified by supplying either the average (-a) option, the hourly profile (-h) option, and/or the clipping (-c) option.

The -s and -e options are used to select the starting date and ending date, respectively, to report on. The format for the date is one of: +days (days since the beginning of the wtmp file) or -days (days before the end of the wtmp file) or in standard date format: MM/DD/YY.

Selecting the average option for total usage, gives an average number of login hours per day since the creation of the wtmp file. For the daily option it prints the total # of logins for the day and the average login time per login. For the per person display it displays the total number of logins the user has made and the average amount of time spent on each login.

Selecting the hourly profile option for total usage gives a visual display of the percentage of login time spent per hour for all the logins on the system. For the daily option it prints the same visual display for each day. For the per person display it displays the hourly breakdown of login time the user spends on the system (this can be pretty interesting).

Selecting the -c option performs clipping on the amount of login time being used. Multiple logins during the same time period will only count once. As a side effect (possibly a bug) clipping will affect the output of the average option, reporting only the number of logins that uniquely apply to the total login time. Logins that fall totally within the time span of other logins will be totally clipped out, as if they did not occur.

If the optional user-list is given sac will only consider accounting information from those users, discarding the rest. The -u option can be used to precede the optional user-list. This option is useful to terminate the -x, -T and -H options.

The -x option, has the reverse effect of the -u option, in that it excludes the users specified from accounting. This is useful for removing users that are on a lot, which skew average usage results.

The -T option performs accounting for only the optionally specified tty lines listed. This is useful for determining modem usage, and who's been using them the most.

The -H option performs accounting for only the optionally specified hosts listed. Since a host-name can only be up to 16 characters long in the wtmp file, only the first 16 characters of a given host-name will be considered for purposes of matches. If a host-name given on the command line does not contain any dots (.) or ends with a dot, it is taken to be a substring and will match if the first part of the wtmp host-name matches the substring.

The -f option makes sac perform accounting on both normal logins and ftp logins. The -F option makes sac perform accounting on ftp logins, normal logins are not considered. Sac is only guaranteed to work with wu-ftpd (wu-archive FTP daemon) style of utmp entry for ftp logins, denoted by a line of "ftp#####" where "#####" is the process ID of the ftp process.
 

OPTIONS

Sac understands the following command line switches:
--help
Outputs a verbose usage listing.

-w wtmp
Select a different input file instead of the default (/var/log/wtmp).

-d
List login time per day instead of the default total time.

-p
List login time per user instead of the default total time.

-a
Print average information.

-h
Print hourly profile information.

-c
Perform login "clipping". Multiple logins during the same time period will only count once.

-o
Read the wtmp file as if it were an old style BSD wtmp file (old utmp format which does not use ut_type field). Programs such as tacacs maintain a wtmp file which does not use all the fields.

-t
Read a wtmp file maintained by (possibly only some versions) of Tacacs, terminal server access control software.

-b hours[:minutes[:seconds]]
Consider only those utmp entries that fall within the last few hours/minutes/seconds from the current time, disregarding the rest. This option is useful for determining if someone has been on in the last few hours.

-s start
Selects the starting date of the report.

-e end
Selects the ending date of the report.

-f
Perform ftp login accounting in addition to normal shell accounting.

-F
Perform ftp login accounting only.

-m
Show minimum and maximum number of concurrent logins over the total time span or per day when used with the -d option. -m is ignored when per user accounting is selected.

-u user-list
Selects only those users to perform accounting on.

-x user-list
Selects those users to not perform accounting on.

-T tty-list
Selects those ttys to perform accounting on.

-H host-list
Selects those hosts to perform accounting on.

 

FILES

/var/log/wtmp login database  

AUTHOR

Steve Baker (ice@mama.indstate.edu)  

BUGS

The documentation for wtmp is lacking. It's not clear at all what all gets put in wtmp or the significance of any of it. Good luck getting this to work on Solaris machines.

The -o and -t options handle what is a login and a logout differently than normally (because there is no ut_type field), making sac incorrectly identify xterm log-outs as a login (xterm does not write a "login" entry, only a "logout" entry that looks just like a login in all respects save the contents of the ut_type field). It should also be noted that last incorrectly handles xterm log-outs as well.

Sac (probably) only handles changes in time logged in the wtmp file made by netdate. Rdate does not log time changes.

Clipping can affect the output of the average option, as described above.

The ut_addr field doesn't seem to be consistently used by all programs, so it cannot be used for exact host-name filtering. Even if it were, it would be too much work for this lazy programmer anyway.

Too much accounting results in big brother... citizen.  

SEE ALSO

last(1), rawtmp(1)


 

Index

NAME
SYNOPSIS
DESCRIPTION
OPTIONS
FILES
AUTHOR
BUGS
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 22:25:48 GMT, January 16, 2023